package com.ruoyi.web.controller.doulai;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.Request2MapUtil;
import com.ruoyi.system.domain.ConsumeLog;
import com.ruoyi.system.service.IConsumeLogService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.common.page.TableDataInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.ExcelUtil;

import javax.servlet.http.HttpServletRequest;

/**
 * 消费记录 信息操作处理
 * 
 * @author ruoyi
 * @date 2019-01-06
 */
@Controller
@RequestMapping("/doulai/consumeLog")
public class ConsumeLogController extends BaseController
{
    private String prefix = "doulai/consumeLog";
	
	@Autowired
	private IConsumeLogService consumeLogService;

	@GetMapping()
	public String consumeLog()
	{
	    return "/pages/record/consume";
	}
	
	/**
	 * 查询消费记录列表
	 */
	@RequiresPermissions("doulai:consumeLog:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(HttpServletRequest request)
	{
		startPage();
		Map<String, Object> map = Request2MapUtil.wrapMap(request);
		List<ConsumeLog> list = consumeLogService.selectConsumeLogList(map);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出消费记录列表
	 */
	@RequiresPermissions("doulai:consumeLog:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(HttpServletRequest request)
    {
		Map<String, Object> map = Request2MapUtil.wrapMap(request);
		List<ConsumeLog> list = consumeLogService.selectConsumeLogList(map);
        ExcelUtil<ConsumeLog> util = new ExcelUtil<ConsumeLog>(ConsumeLog.class);
        return util.exportExcel(list, "consumeLog");
    }
	

}
